﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UA.Data;
using UA.Data.Model;
using UA.Framework.Authorization;

namespace UA.Framework.Views
{
    public class MainView
    {
        private Power[] _powers;
        private UserAccessor _userAccessor;

        public MainView()
        {
        }


        protected internal UserAccessor UserAccessor
        {
            get
            {
                if (this._userAccessor == null)
                {
                    this._userAccessor = new UserAccessor();
                }
                return this._userAccessor;
            }
        }




        public Power[] Powers
        {
            get
            {
                if (this._powers == null)
                {
                    this._powers = this.UserAccessor.GetPowers(UAAuthentication.UserToken.UserID.Value).Where(p => p.PowerType.HasFlag(PowerType.Menu)).ToArray();
                }
                return this._powers;
            }
        }




    }
}
